home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / TimeSchedulerPQ.h,v < prev    next >
Text File  |  1989-02-23  |  3KB  |  100 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.38.01;  author grunwald;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 3.2
  21. log
  22. @Start using Gnu library heaps for schedulers
  23. @
  24. text
  25. @// This may look like C code, but it is really -*- C++ -*-
  26. /* 
  27. Copyright (C) 1988 Free Software Foundation
  28.     written by Doug Lea (dl@@rocky.oswego.edu)
  29.  
  30. This file is part of GNU CC.
  31.  
  32. GNU CC is distributed in the hope that it will be useful,
  33. but WITHOUT ANY WARRANTY.  No author or distributor
  34. accepts responsibility to anyone for the consequences of using it
  35. or for whether it serves any particular purpose or works at all,
  36. unless he says so in writing.  Refer to the GNU CC General Public
  37. License for full details.
  38.  
  39. Everyone is granted permission to copy, modify and redistribute
  40. GNU CC, but only under the conditions described in the
  41. GNU CC General Public License.   A copy of this license is
  42. supposed to have been given to you along with GNU CC so you
  43. can know your rights and responsibilities.  It should be in a
  44. file named COPYING.  Among other things, the copyright notice
  45. and this notice must be preserved on all copies.  
  46. */
  47.  
  48.  
  49. #ifndef _TimeSchedulerPQ_h
  50. #define _TimeSchedulerPQ_h 1
  51.  
  52. #include "Pix.h"
  53. #include "TimeSchedulerdefs.h"
  54.  
  55. class TimeSchedulerPQ
  56. {
  57. protected:
  58.  
  59.   int                   count;
  60.  
  61. public:
  62.   int                   length();                // current number of items
  63.   int                   empty();
  64.  
  65.   virtual Pix           enq(TimeScheduler& item);          // add item; return Pix
  66.   virtual TimeScheduler           deq();                   // return & remove min
  67.  
  68.   virtual TimeScheduler&          front();                 // access min item
  69.   virtual void          del_front();             // delete min item
  70.  
  71.   virtual int           contains(TimeScheduler& item);     // is item in PQ?
  72.  
  73.   virtual void          clear();                 // delete all items
  74.  
  75.   virtual Pix           first();                 // Pix of first item or 0
  76.   virtual void          next(Pix& i);            // advance to next or 0
  77.   virtual TimeScheduler&          operator () (Pix i);     // access item at i
  78.   virtual void          del(Pix i);              // delete item at i
  79.   virtual int           owns(Pix i);             // is i a valid Pix  ?
  80.   virtual Pix           seek(TimeScheduler& item);         // Pix of item
  81.  
  82.   void                  error(char* msg);
  83.   virtual int           OK();                    // rep invariant
  84. };
  85.  
  86.  
  87. inline int TimeSchedulerPQ::length()
  88. {
  89.   return count;
  90. }
  91.  
  92. inline int TimeSchedulerPQ::empty()
  93. {
  94.   return count == 0;
  95. }
  96.  
  97.  
  98. #endif
  99. @
  100.